#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
namespace hx
{
	template <class T>
	struct node
	{
		node* _prev;
		node* _next;
		T _data;

		node(const T& val = T())
			:_prev(nullptr)
			, _next(nullptr)
			, _data(val)
		{}
	};
	template <class T>
	struct _iterator
	{
		typedef node<T> node;
		node* _pnode;

		_iterator operator*()
		{
			return _pnode->_data;
		}
		_iterator& operator++()
		{
			_pnode = _pnode->_next;
			return *this;
		}
	};
	template <class T>
	class list
	{
		typedef node<T> node;
		typedef _iterator<T> _iterator;
	private:
		node* _phead;
	public:
		_iterator begin()
		{
			return _phead->_next;
		}

		_iterator end()
		{
			return _phead;
		}

		list()
		{
			_phead = new node(T());
			_phead->_next = _phead;
			_phead->_prev = _phead;
		}

		list(const node* p)
			:_phead(p)
		{
		}

		void push_back(const T& val)
		{
			node* newnode = new node(val);
			node* prev = _phead->_prev;

			newnode->_next = _phead;
			newnode->_prev = prev;
			prev->_next = newnode;
			_phead->_prev = newnode;
		}

	};
}
int main()
{
	hx::list<int> lt;
	lt.push_back(1);
	return 0;
}